package sqladapter;


public class SQLFieldAttributes 
{
	public final static Integer TYPE_STRING =0;
	public final static Integer TYPE_NUMBER =1;	
	public final static Integer TYPE_NOT_DEF =666;
	

	public final static String TYPE_STRING_NAME ="String";
	public final static String TYPE_NUMBER_NAME ="Number";	
	
	public final static String TRUE = "true";	
	public final static String FALSE = "false";
	
	public final static String ATTRIBUTE_FIELD_NAME = "fieldName"; //nazwa tabeli jak w bazie
	public final static String ATTRIBUTE_FIELD_TYPE = "fieldType"; //tym jak w staticach tu
	public final static String ATTRIBUTE_FIELD_VISIBLE = "visible";	 // czy bedzie widoczne w browserze, jako string
	public final static String ATTRIBUTE_FIELD_ALLIAS = "alias"; //nazwa kolumny
	public final static String ATTRIBUTE_FIELD_FUNC = "func"; //funkja dodawana do zapytan
	
	private String fieldName;
	private Integer fieldType;
	private String visible;
	private String allias;
	private String func;
	
	public SQLFieldAttributes(String fieldName,String fieldType, String visible, String allias,String func) throws Exception
	{
		this.fieldName=fieldName;
		if(fieldType.equals(SQLFieldAttributes.TYPE_STRING_NAME))
			this.fieldType = SQLFieldAttributes.TYPE_STRING;
		else if(fieldType.equals(SQLFieldAttributes.TYPE_NUMBER_NAME))
			this.fieldType = SQLFieldAttributes.TYPE_NUMBER;
		else
			throw new Exception("Nieznany tryb danych : " + fieldType);
		this.visible = visible;
		this.allias = allias;
		this.func=func;
	}
	public String getFieldName()
	{
		return fieldName;
	}
	public Integer getFieldType()
	{
		return fieldType;		
	}
	public String getFieldVisible()
	{
		return visible;
	}
	public String getFieldAllias()
	{
		return allias;
	}

	public void setFieldName(String fieldName)
	{
		 this.fieldName=fieldName;
	}
	public void setFieldType(Integer fieldType)
	{
		this.fieldType=fieldType;		
	}
	public void setFieldVisible(String visible)
	{
		this.visible=visible;
	}
	public void setFieldAllias(String allias)
	{
		this.allias=allias;
	}
	public String getFunc() {
		return func;
	}
	public void setFunc(String func) {
		this.func = func;
	}
	
}
